/*  1:   */ package org.jetbrains.jps.model.serialization;
/*  2:   */ 
/*  3:   */

import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.util.text.StringUtil;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.JpsEncodingConfigurationService;
import org.jetbrains.jps.model.JpsGlobal;
import org.jetbrains.jps.model.JpsProject;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */ 
/* 15:   */ public class JpsEncodingModelSerializerExtension
/* 16:   */   extends JpsModelSerializerExtension
/* 17:   */ {
/* 18:   */   @NotNull
/* 19:   */   public List<? extends JpsProjectExtensionSerializer> getProjectExtensionSerializers()
/* 20:   */   {
/* 21:38 */     List tmp18_15 = Arrays.asList(new JpsEncodingConfigurationSerializer[] { new JpsEncodingConfigurationSerializer(null) });
/* 22:38 */     if (tmp18_15 == null) {
/* 23:38 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/serialization/JpsEncodingModelSerializerExtension", "getProjectExtensionSerializers" }));
/* 24:   */     }
/* 25:38 */     return tmp18_15;
/* 26:   */   }
/* 27:   */   
/* 28:   */   @NotNull
/* 29:   */   public List<? extends JpsGlobalExtensionSerializer> getGlobalExtensionSerializers()
/* 30:   */   {
/* 31:44 */     List tmp18_15 = Arrays.asList(new JpsGlobalEncodingSerializer[] { new JpsGlobalEncodingSerializer(null) });
/* 32:44 */     if (tmp18_15 == null) {
/* 33:44 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/jps/model/serialization/JpsEncodingModelSerializerExtension", "getGlobalExtensionSerializers" }));
/* 34:   */     }
/* 35:44 */     return tmp18_15;
/* 36:   */   }
/* 37:   */   
/* 38:   */   private static class JpsEncodingConfigurationSerializer
/* 39:   */     extends JpsProjectExtensionSerializer
/* 40:   */   {
/* 41:   */     JpsEncodingConfigurationSerializer(JpsEncodingModelSerializerExtension.0 param0)
/* 42:   */     {
/* 43:47 */       this();
/* 44:   */     }
/* 45:   */     
/* 46:   */     private JpsEncodingConfigurationSerializer()
/* 47:   */     {
/* 48:49 */       super("Encoding");
/* 49:   */     }
/* 50:   */     
/* 51:   */     public void loadExtension(@NotNull JpsProject paramJpsProject, @NotNull Element paramElement)
/* 52:   */     {
/* 53:54 */       if (paramJpsProject == null) {
/* 54:54 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/serialization/JpsEncodingModelSerializerExtension$JpsEncodingConfigurationSerializer", "loadExtension" }));
/* 55:   */       }
/* 56:54 */       if (paramElement == null) {
/* 57:54 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/jps/model/serialization/JpsEncodingModelSerializerExtension$JpsEncodingConfigurationSerializer", "loadExtension" }));
/* 58:   */       }
/* 59:54 */       Object localObject = null;
/* 60:55 */       HashMap localHashMap = new HashMap();
/* 61:56 */       for (Element localElement : JDOMUtil.getChildren(paramElement, "file"))
/* 62:   */       {
/* 63:57 */         String str1 = localElement.getAttributeValue("url");
/* 64:58 */         String str2 = localElement.getAttributeValue("charset");
/* 65:59 */         if (str1.equals("PROJECT")) {
/* 66:60 */           localObject = str2;
/* 67:   */         } else {
/* 68:63 */           localHashMap.put(str1, str2);
/* 69:   */         }
/* 70:   */       }
/* 71:66 */       JpsEncodingConfigurationService.getInstance().setEncodingConfiguration(paramJpsProject, localObject, localHashMap);
/* 72:   */     }
/* 73:   */     
/* 74:   */     public void saveExtension(@NotNull JpsProject paramJpsProject, @NotNull Element paramElement)
/* 75:   */     {
/* 76:71 */       if (paramJpsProject == null) {
/* 77:71 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/serialization/JpsEncodingModelSerializerExtension$JpsEncodingConfigurationSerializer", "saveExtension" }));
/* 78:   */       }
/* 79:71 */       if (paramElement == null) {
/* 80:71 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/jps/model/serialization/JpsEncodingModelSerializerExtension$JpsEncodingConfigurationSerializer", "saveExtension" }));
/* 81:   */       }
/* 82:   */     }
/* 83:   */   }
/* 84:   */   
/* 85:   */   private static class JpsGlobalEncodingSerializer
/* 86:   */     extends JpsGlobalExtensionSerializer
/* 87:   */   {
/* 88:   */     public static final String ENCODING_ATTRIBUTE = "default_encoding";
/* 89:   */     
/* 90:   */     JpsGlobalEncodingSerializer(JpsEncodingModelSerializerExtension.0 param0)
/* 91:   */     {
/* 92:74 */       this();
/* 93:   */     }
/* 94:   */     
/* 95:   */     private JpsGlobalEncodingSerializer()
/* 96:   */     {
/* 97:78 */       super("Encoding");
/* 98:   */     }
/* 99:   */     
/* :0:   */     public void loadExtension(@NotNull JpsGlobal paramJpsGlobal, @NotNull Element paramElement)
/* :1:   */     {
/* :2:83 */       if (paramJpsGlobal == null) {
/* :3:83 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/serialization/JpsEncodingModelSerializerExtension$JpsGlobalEncodingSerializer", "loadExtension" }));
/* :4:   */       }
/* :5:83 */       if (paramElement == null) {
/* :6:83 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/jps/model/serialization/JpsEncodingModelSerializerExtension$JpsGlobalEncodingSerializer", "loadExtension" }));
/* :7:   */       }
/* :8:83 */       String str = paramElement.getAttributeValue("default_encoding");
/* :9:84 */       JpsEncodingConfigurationService.getInstance().setGlobalEncoding(paramJpsGlobal, StringUtil.nullize(str));
/* ;0:   */     }
/* ;1:   */     
/* ;2:   */     public void saveExtension(@NotNull JpsGlobal paramJpsGlobal, @NotNull Element paramElement)
/* ;3:   */     {
/* ;4:89 */       if (paramJpsGlobal == null) {
/* ;5:89 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/jps/model/serialization/JpsEncodingModelSerializerExtension$JpsGlobalEncodingSerializer", "saveExtension" }));
/* ;6:   */       }
/* ;7:89 */       if (paramElement == null) {
/* ;8:89 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/jps/model/serialization/JpsEncodingModelSerializerExtension$JpsGlobalEncodingSerializer", "saveExtension" }));
/* ;9:   */       }
/* <0:89 */       paramElement.setAttribute("default_encoding", JpsEncodingConfigurationService.getInstance().getGlobalEncoding(paramJpsGlobal));
/* <1:   */     }
/* <2:   */   }
/* <3:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.jps.model.serialization.JpsEncodingModelSerializerExtension

 * JD-Core Version:    0.7.0.1

 */